package com.zlfund.cat.demo;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Path;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.View;

/**
 * Created by chenj
 * Created on 2017/7/21
 */

public class TestView extends View {

    private Paint mPaint;
    private Path mPath;

    public TestView(Context context) {
        this(context,null);
    }

    public TestView(Context context, @Nullable AttributeSet attrs) {
        this(context, attrs,0);
    }

    public TestView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        mPath = new Path();
        mPaint = new Paint();
        mPaint.setColor(Color.BLACK);
        mPaint.setTextSize(20);
    }

    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        canvas.drawText("aaaa",0,20,mPaint);
        canvas.save();
        canvas.translate(50,50);
//        canvas.rotate(180,getWidth() / 2,getHeight() / 2);
        canvas.drawCircle(20,20,20,mPaint);
        canvas.restore();
        canvas.drawText("bbb",0,40,mPaint);
    }
}
